package com.dede.screensaverhelper

import android.content.Context
import java.io.File

/**
 * @author hsh
 * @since 2018/2/1 16:56.
 */
object Config {

    // pre key
    const val OPEN = "open"
    const val OPEN_SETTING = "open_setting"
    const val DREAM_ENABLE = "dream_enable"
    const val KEEP_SCREEN_ON = "keep_screen_on"
    const val DISABLE_HOME = "disable_home"

    // dex file name
    const val dexFileName = "dream.dex"
    // dex main class
    const val mainClass = "com.dede.locallib.Helper"

    // Setting key
    const val SCREENSAVER_ENABLED = "screensaver_enabled"
}

/**
 * dex file path
 */
fun Context.dexFile() = File(this.filesDir, Config.dexFileName)

/**
 * 文件是否合法
 */
fun File.legalFile() = this.exists() && this.isFile && this.length() > 0

